<template>
	<view class="box">
		<uNavbar title="账号安全" bgColor="transparent"></uNavbar>
		<view class="wrap" @click="gorealname">
			<view class="text">实名认证</view>
			<view class="tip">
				{{user.is_real?"已实名":"未实名"}}
			</view>
			<uni-icons type="right" color="#A6A5AF" size="22" class="right"></uni-icons>
		</view>
		<view class="wrap"  data-url="/pagesMy/setting/amendphonenum" @click="allJump">
			<view class="text">修改手机号码</view>
			<view class="del_text">
				{{user.phone}}
			</view>
			<uni-icons type="right" color="#A6A5AF" size="22" class="right"></uni-icons>
		</view>
		<view class="wrap"  data-url="/pagesMy/setting/forgetphonenum" @click="allJump">
			<view class="text">忘记手机号码</view>
			<uni-icons type="right" color="#A6A5AF" size="22" class="right"></uni-icons>
		</view>
		<view class="wrap"  data-url="/pagesMy/setting/amendloginpassword" @click="allJump">
			<view class="text">修改登录密码</view>
			<uni-icons type="right" color="#A6A5AF" size="22" class="right"></uni-icons>
		</view>
		<view class="wrap"  data-url="/pagesMy/setting/amendsafepassword" @click="allJump">
			<view class="text">修改交易密码</view>
			<uni-icons type="right" color="#A6A5AF" size="22" class="right"></uni-icons>
		</view>
		<view class="wrap"  data-url="/pagesMy/setting/address" @click="allJump">
			<view class="text">修改通证地址</view>
			<uni-icons type="right" color="#A6A5AF" size="22" class="right"></uni-icons>
		</view>
		<view class="wrap" v-if="user.is_invite_code" data-url="/pagesMy/setting/recommend" @click="allJump">
			<view class="text">修改推荐码</view>
			<uni-icons type="right" color="#A6A5AF" size="22" class="right"></uni-icons>
		</view>
		<view class="wrap"  data-url="/pagesMy/setting/cancellation" @click="allJump">
			<view class="text">注销账户</view>
			<uni-icons type="right" color="#A6A5AF" size="22" class="right"></uni-icons>
		</view>
	</view>
</template>

<script>
import {getuserinfo} from "../../api/index.js"
	export default {
		data() {
			return {
				user:{}
			}
		},
		onLoad() {
			this.getuser()
		},
		onShow() {
			this.getuser()
		},
		methods: {
			allJump(e){
				console.log(e);
				let {url} = e.currentTarget.dataset;
				uni.navigateTo({
					url:url
				})
			},
			getuser(){
				getuserinfo().then(res=>{
					this.user=res.data
					console.log(res.data,999)
					
				})
			},
			gorealname(){
				if(this.user.is_real){
					uni.$u.toast("已实名")
				}else{
					uni.navigateTo({
						url:"/pagesMy/setting/realname"
					})
				}
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		width: 750rpx;
		height: 100vh;
		background-color: #211E38;
	}
	.wrap{
		width: 750rpx;
		height: 94rpx;
		position: relative;
		background-color: 211E38;
		margin-top: 20rpx;
		display: flex;
		align-items: center;
		.text{
			position: absolute;
			// top: 28rpx;
			left: 20rpx;
			font-size: 32rpx;
			color: #fff;
		}
		.right{
			position: absolute;
			// top: 28rpx;
			right: 30rpx;
		}
		.tip{
			position: absolute;
			// top: 28rpx;
			right: 80rpx;
			font-size: 32rpx;
			color: #FF2CDF;
		}
		.del_text{
			position: absolute;
			// top: 28rpx;
			right: 80rpx;
			font-size: 32rpx;
			color: #A7A4AD;
		}
	}
</style>